package cn.patient.pp.module.knowledge.dal.mysql;
import java.util.*;

import cn.patient.pp.framework.common.pojo.PageResult;
import cn.patient.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.patient.pp.framework.mybatis.core.mapper.BaseMapperX;
import cn.patient.pp.module.knowledge.controller.admin.vo.KnowledgeBasePageReqVO;
import cn.patient.pp.module.knowledge.dal.dataobject.KnowledgeBaseDO;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author liqingsong
 * @version 1.0
 * Create by 2025/4/14
 */
@Mapper
public interface KnowledgeBaseMapper extends BaseMapperX<KnowledgeBaseDO> {

    default PageResult<KnowledgeBaseDO> selectPage(KnowledgeBasePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KnowledgeBaseDO>()
                .likeIfPresent(KnowledgeBaseDO::getName, reqVO.getName())
                .eqIfPresent(KnowledgeBaseDO::getNumber, reqVO.getNumber())
                .eqIfPresent(KnowledgeBaseDO::getTextAttachmentUrl, reqVO.getTextAttachmentUrl())
                .eqIfPresent(KnowledgeBaseDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(KnowledgeBaseDO::getPublishDate, reqVO.getPublishDate())
                .betweenIfPresent(KnowledgeBaseDO::getExecDate, reqVO.getExecDate())
                .betweenIfPresent(KnowledgeBaseDO::getAbortDate, reqVO.getAbortDate())
                .betweenIfPresent(KnowledgeBaseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(KnowledgeBaseDO::getId));
    }
}
